# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=telepathy-accounts-signon
pkgver=1.0
pkgrel=3
pkgdesc="A mission control plugin for Telepathy, integrating with libaccounts and libsignon to provide IM accounts and authentication"
arch=(x86_64)
url='https://gitlab.com/accounts-sso/telepathy-accounts-signon'
license=(LGPL)
depends=(telepathy-mission-control libaccounts-glib libsignon-glib)
makedepends=(qt5-base)
source=("https://gitlab.com/accounts-sso/$pkgname/repository/archive.tar.gz?ref=$pkgver"
        libsignon-glib-2.patch::"https://gitlab.com/accounts-sso/telepathy-accounts-signon/commit/df1ef923.patch")
sha256sums=('9b9e4ef2f98d93ccb4d73ba6623ef38bd8f167965c68ec2486c0d9b8035a93ed'
            'e736cc371560c25ddbe92b7a6624355f05e72219e48df2c8c128192af0f58290')

prepare() {
  mkdir -p build
  mv $pkgname-$pkgver-* $pkgname-$pkgver

  cd $pkgname-$pkgver/mcp-account-manager-accounts-sso
  patch -p2 -i ../../libsignon-glib-2.patch # Fix build with libsignon-glib 2.0
}

build() {
  cd build
  qmake-qt5 ../$pkgname-$pkgver
  make
}

package() {
  cd build
  make INSTALL_ROOT="$pkgdir" install
}
